<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">


<%@ page import="javax.servlet.http.*,
                 com.scalar.chiptrack.utils.ConfigManager,
				 com.scalar.chiptrack.operations.process.forms.FabProcessSplitForm" %>


<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<chiptrack:checkLogon sourcePage="/baseProductList.do"/>

<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>

<script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>


<% HttpSession ses = request.getSession(true); 

  String baseProductName = (String) ses.getAttribute("baseProductName");

   %>

<HTML><HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type=text/css rel=stylesheet>

<SCRIPT>

function newfun(obj)
{

     document.fabprocess.WaferStore.value=obj.value;
	 alert(document.fabprocess.WaferStore.value);

}

function cancel() {
	document.fabprocess.action ="<%=chipTracContext%>/baseProductList.do";
	document.fabprocess.submit();
}


function addBack(){

//document.fabprocess.fabCount.value= 3 ;
/*var noOfFabs = document.fabprocess.fabCount.value;
if(parseInt(noOfFabs)>3){
//var extraFabs = noOfFabs-3; 
for(var i=3;i<parseInt(noOfFabs);i++){
alert(document.fabprocess.fabProduct[i].value);
addMore();
}

}
else
return; */

}

function func() 
{
var pa=document.getElementById("message");
var noOfFabs = document.fabprocess.fabCount.value;
var noFab ='false';

	for(var i=0;i<parseInt(noOfFabs);i++)
	{
		var fabName = document.fabprocess.fabProduct[i].value;
		fabName = trim(fabName);
		document.fabprocess.fabProduct[i].value = fabName;
		if(fabName!='')
		{
			noFab='true';					
			for(var j=0;j<parseInt(noOfFabs);j++ )
			{
				if(i!=j)
				{  	
					 if(fabName==document.fabprocess.fabProduct[j].value)
					 { 				
						 pa.innerHTML = "Same Fab names are not allowed here.Please change... ";	
						 return;
					 }
				}
			}	
		}
	} 

	if(noFab=='false')
	{
		pa.innerHTML = "You need to have atleast one FAB.";	
		return;
	}
    document.fabprocess.submit(); 
}

if (document.layers)
  window.setResizable(false);
  var c = 0;

function addMore() {
var currentval=document.fabprocess.fabCount.value;
var htmltext = '<input type="text" name="fabProduct" size="20" class="txfield" value=""><br>';
var pa=document.getElementById("font1");
pa.insertAdjacentHTML('BeforeEnd',htmltext);
var cnt=parseInt(currentval)+1;
document.fabprocess.fabCount.value = cnt;

}

</SCRIPT>


<META content="MSHTML 5.50.4807.2300" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff leftMargin=0 topMargin=0 marginheight="0" marginwidth="0" onLoad="javascript:addBack();">

<html:form name="fabprocess" type="com.scalar.chiptrack.operations.process.forms.FabProcessSplitForm" action="/fabprocesssplit" >  

<input type="hidden"  name="WaferStore" value="0">

<!-- Top Header Start-->

<%@ include file="/jsp/includes/header.jsp" %>

<!-- Top Header End-->

<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
	<TD width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>

<!-- Side Navigation start -->

<%@ include file="/jsp/operations/operations_menu.jsp"%>
	</TD>
<!-- end of the side navigations -->

<TD bgcolor="#ffffff">
<IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
<TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
<TD valign="top" width="100%">

<IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
<BR>
<!-- from here your body starts -->

<center><span class="NArialW">Fab Process Setup</span></center>
<img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20>
<center>
<strong><font class="NArialL"><font color="FF0000"><font id="message"></font></font></font>
</center>
<center><chiptrack:errors styleClass="NArialL"/></center>

<table border="0" width="90%" align=right>
    <tr><td colspan=2><font class="NArialL">Please enter the optional product names you want to make out from this product
    	</font></td>  </tr>
    <tr><td colspan=2><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
    <tr>
      <td><font class="NArialL" valign=top>Base Product Name : <%=baseProductName%></font></td>
      <td><font class="NArialL">
		<% if( request.getAttribute("fabprocess") != null ) {
			FabProcessSplitForm fab = (FabProcessSplitForm)request.getAttribute("fabprocess");
			String[] xyz = fab.getFabProduct(); %>
			<input type="hidden" name="fabCount" value="<%=xyz.length%>" >
		<%		for(int i=0; i < xyz.length; i++ ){
		%>
		 
	      	<input type="text" name="fabProduct" size="20" class="txfield" value="<%=xyz[i]%>"><br>
		
		<%}}else{%>
		<input type="hidden" name="fabCount" value="3" >
		<input type="text" name="fabProduct" size="20" class="txfield" value=""><br>
      	<input type="text" name="fabProduct" size="20" class="txfield" value=""><br>
      	<input type="text" name="fabProduct" size="20" class="txfield" value=""><br> 
		<%}%>
	    <font id=font1></font>
		<br><br>
      	<a href="javascript:addMore()">
		<img border="0" src="<%=chipTracContext%>/jsp/includes/images/addmore.gif"></a>
      </td>
    </tr>
    <tr><td colspan=2><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></td></tr>
    <tr><td colspan=2><font class="NArialL">Would you like to put the products in the WAFER STORE before Sort
    	</font></td>  </tr>
    <tr><td colspan=2><font class="NArialL">
	<input type="radio" name="waferStore" value="0" checked/>Yes &nbsp;&nbsp;&nbsp;
    <input type="radio" name ="waferStore" value="1"/>No
    	</font></td></tr>
	<tr><td colspan=2><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></td></tr>
	<tr>
      <td colspan=2 align=center>
	  <chiptrack:restrictedLink functionality='<%=Functionality.PRODUCT_SETUP%>' action='<%=User.USER_ACTION_MODIFY%>' href='javascript:func();' onmouseover="window.status='Click here to save the Fab Process';return true" onmouseout="window.status='';return true">
     <img border="0" src="<%=chipTracContext%>/jsp/includes/images/next.gif"></chiptrack:restrictedLink>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	 <chiptrack:restrictedLink functionality='<%=Functionality.PRODUCT_SETUP%>' action='<%=User.USER_ACTION_MODIFY%>' href='javascript:cancel();' onmouseover="window.status='Click here to return to Product List';return true" onmouseout="window.status='';return true">
      <img border="0" src="<%=chipTracContext%>/jsp/includes/images/cancel.gif"></td></chiptrack:restrictedLink>
    </tr>
  </table>
<!-- till here -->
<BR><BR><BR></TD>
<TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
</TR>
</TABLE>

<!-- Footer starts here -->

<%@ include file="/jsp/includes/footer.jsp" %>

<!-- footer end here -->
</html:form>
</BODY>
</html>
